This analysis looks at the beta series connectivity between the fronto-parietal control and default mode networks from the Yeo atlas, in addition to individually defined ROIs from the FFA and the anterior, medial and posterior HPC. Individual connectivity matrices are calculated for each task period (encoding, delay and probe).

library(tidyverse)
## ── Attaching packages ──────────────────────────────────────────────────────────────────────────────────────── tidyverse 1.3.0 ──
## ✓ ggplot2 3.3.2     ✓ purrr   0.3.4
## ✓ tibble  3.0.3     ✓ dplyr   1.0.1
## ✓ tidyr   1.1.1     ✓ stringr 1.4.0
## ✓ readr   1.3.1     ✓ forcats 0.5.0
## ── Conflicts ─────────────────────────────────────────────────────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
library(psych)
## 
## Attaching package: 'psych'
## The following objects are masked from 'package:ggplot2':
## 
##     %+%, alpha
library(rmatio)
library(patchwork)
library(reshape2)
## 
## Attaching package: 'reshape2'
## The following object is masked from 'package:tidyr':
## 
##     smiths
load('data/behav.RData')
load('data/split_groups_info.RData')

source("helper_fxns/calc_network_avg.R")
source("helper_fxns/mutate_for_heatmap.R")
source("helper_fxns/calc_network_avg_matrix.R")

se <- function(x) {
  sd(x,na.rm=TRUE)/sqrt(length(x[!is.na(x)])) 
}

Prep data

avg_beta_series <- list(cue_load1 = read.mat("data/BetaSeries/RcorrCue_load1_Acc1.mat")$R, 
                        cue_load3 = read.mat("data/BetaSeries/RcorrCue_load3_Acc1.mat")$R,
                        delay_load1 = read.mat("data/BetaSeries/RcorrDelay_load1_Acc1.mat")$R, 
                        delay_load3 = read.mat("data/BetaSeries/RcorrDelay_load3_Acc1.mat")$R, 
                        probe_load1 = read.mat("data/BetaSeries/RcorrProbe_load1_Acc1.mat")$R, 
                        probe_load3 = read.mat("data/BetaSeries/RcorrProbe_load3_Acc1.mat")$R)

rois <- read.mat("data/BetaSeries/roi_order.mat")$roi
beta_series_sujs <- unlist(read.mat("data/BetaSeries/suj_order.mat"))
beta_series_cond_order <- read.mat("data/BetaSeries/condition_order.mat")

suj_by_cond <- read.mat("data/BetaSeries/Suj_by_Cond.mat")$Suj_by_Cond
for (cond in seq.int(1,6)){ 
  avg_beta_series[[cond]] <- atanh(avg_beta_series[[cond]])
}

for (suj in seq.int(1,168)){
  for (cond in seq.int(7,12)){
    suj_by_cond[[suj]][[cond]] <- atanh(suj_by_cond[[suj]][[cond]]) 
    
  }
}

For most of these analyses, we are going to just look at the average connectivity across networks. In addition, however, we’re going to break the FPCN into more parietal regions and more PFC regions, and segment the hippocampus into anterior, medial and posterior segments.

avg_data <- data.frame(matrix(nrow=6, ncol=34))
colnames(avg_data) <- c("PTID","FPCN_FPCN", "DMN_DMN", "HPC_HPC", "FFA_FFA", "FPCN_DMN", "FPCN_HPC", "FPCN_FFA", "DMN_HPC",
                        "DMN_FFA", "HPC_FFA", "FPCN_PFC_FPCN_PFC", "FPCN_PFC_FPCN_Par", "FPCN_PFC_DMN", "FPCN_PFC_HPC", 
                        "FPCN_PFC_FFA", "FPCN_Par_DMN", "FPCN_Par_HPC", "FPCN_Par_FFA", "FPCN_HPC_Ant", "FPCN_PFC_HPC_Ant",
                        "FPCN_Par_HPC_Ant", "DMN_HPC_Ant", "FFA_HPC_Ant","FPCN_HPC_Med", "FPCN_PFC_HPC_Med",
                        "FPCN_Par_HPC_Med", "DMN_HPC_Med", "FFA_HPC_Med","FPCN_HPC_Post", "FPCN_PFC_HPC_Post",
                        "FPCN_Par_HPC_Post", "DMN_HPC_Post", "FFA_HPC_Post")

for (cond in seq.int(1,6)){ 
  avg_data[cond,] <- calc_network_avg(names(avg_beta_series)[cond],avg_beta_series[[cond]] )
}

suj_avg_data <- data.frame(matrix(nrow=169, ncol=34))
colnames(suj_avg_data) <- c("PTID","FPCN_FPCN", "DMN_DMN", "HPC_HPC", "FFA_FFA", "FPCN_DMN", "FPCN_HPC", "FPCN_FFA", "DMN_HPC",
                            "DMN_FFA", "HPC_FFA", "FPCN_PFC_FPCN_PFC", "FPCN_PFC_FPCN_Par", "FPCN_PFC_DMN", "FPCN_PFC_HPC", 
                            "FPCN_PFC_FFA", "FPCN_Par_DMN", "FPCN_Par_HPC", "FPCN_Par_FFA", "FPCN_HPC_Ant", "FPCN_PFC_HPC_Ant",
                            "FPCN_Par_HPC_Ant", "DMN_HPC_Ant", "FFA_HPC_Ant","FPCN_HPC_Med", "FPCN_PFC_HPC_Med",
                            "FPCN_Par_HPC_Med", "DMN_HPC_Med", "FFA_HPC_Med","FPCN_HPC_Post", "FPCN_PFC_HPC_Post",
                            "FPCN_Par_HPC_Post", "DMN_HPC_Post", "FFA_HPC_Post")

suj_avg_list <- list(
  cue_load3 = suj_avg_data, 
  delay_load3 = suj_avg_data,
  probe_load3 = suj_avg_data,
  cue_load1 = suj_avg_data, 
  delay_load1 = suj_avg_data,
  probe_load1 = suj_avg_data,
  cue_load_effect = suj_avg_data, 
  delay_load_effect = suj_avg_data, 
  probe_load_effect = suj_avg_data
)

for (cond in seq.int(7,12)){
  for (suj in seq.int(1,169)){
    if (suj != 55){
      suj_avg_list[[cond-6]][suj,] <- calc_network_avg(beta_series_sujs[suj], suj_by_cond[[suj]][[cond]])
    }else{ 
      suj_avg_list[[cond-6]]$PTID[suj] <- beta_series_sujs[suj]
    }
  }
  suj_avg_list[[cond-6]]$PTID <- c(suj_avg_list[[cond-6]]$PTID[1:54], 1554, suj_avg_list[[cond-6]]$PTID[55:168])
}

for (LE in seq.int(7,9)){
  suj_avg_list[[LE]]$PTID <- suj_avg_list[[1]]$PTID
}
suj_avg_list[["cue_load_effect"]][,2:34] <- suj_avg_list[["cue_load3"]][,2:34] - suj_avg_list[["cue_load1"]][,2:34]
suj_avg_list[["delay_load_effect"]][,2:34] <- suj_avg_list[["delay_load3"]][,2:34] - suj_avg_list[["delay_load1"]][,2:34]
suj_avg_list[["probe_load_effect"]][,2:34] <- suj_avg_list[["probe_load3"]][,2:34] - suj_avg_list[["probe_load1"]][,2:34]

avg_data[7,2:34] <- avg_data[2,2:34]- avg_data[1,2:34]
avg_data$PTID[7] <- "cue_load_effect"
avg_data[8,2:34] <- avg_data[4,2:34]- avg_data[3,2:34]
avg_data$PTID[8] <- "delay_load_effect" 
avg_data[9,2:34] <- avg_data[6,2:34]- avg_data[5,2:34]
avg_data$PTID[9] <- "probe_load_effect"

avg_beta_series[["cue_load_effect"]] <- avg_beta_series[["cue_load3"]] - avg_beta_series[["cue_load1"]]
avg_beta_series[["delay_load_effect"]] <- avg_beta_series[["delay_load3"]] - avg_beta_series[["delay_load1"]]
avg_beta_series[["probe_load_effect"]] <- avg_beta_series[["probe_load3"]] - avg_beta_series[["probe_load1"]]
check_span_groups <- constructs_fMRI 

check_span_groups<- check_span_groups[order(check_span_groups$omnibus_span_no_DFR_MRI),]
check_span_groups$without_MRI <- "low"
check_span_groups$without_MRI[57] <- "not_incl"
check_span_groups$without_MRI[58:113] <- "med"
check_span_groups$without_MRI[114] <- "not_incl"
check_span_groups$without_MRI[115:170] <- "high"

check_span_groups<- check_span_groups[order(check_span_groups$omnibus_span_no_DFR),]
check_span_groups$without_EEG <- "low"
check_span_groups$without_EEG[57] <- "not_incl"
check_span_groups$without_EEG[58:113] <- "med"
check_span_groups$without_EEG[114] <- "not_incl"
check_span_groups$without_EEG[115:170] <- "high"

#sum(check_span_groups$without_MRI != check_span_groups$without_EEG, na.rm=TRUE)
check_span_groups <- merge(check_span_groups, p200_demographics)
colnames(check_span_groups)[10] <- "level"

WM_groups_no_EEG <- list(high = check_span_groups %>% filter(level == "high"),
                         med = check_span_groups %>% filter(level == "med"), 
                         low = check_span_groups %>% filter(level == "low"))

WM_groups_no_EEG[["all"]] <- rbind(WM_groups_no_EEG[["low"]],WM_groups_no_EEG[["med"]],WM_groups_no_EEG[["high"]] )
WM_merge <- merge(WM_groups_no_EEG[["all"]], constructs_fMRI)

for (cond in seq.int(1,9)){
  suj_avg_list[[cond]] <- merge(suj_avg_list[[cond]], WM_merge, by = "PTID")
}
for (cond in seq.int(4,9)){
  for (col in seq.int(2,34)){
    m <- mean(suj_avg_list[[cond]][,col], na.rm=TRUE)
    s <- sd(suj_avg_list[[cond]][,col], na.rm=TRUE)
    max <- m + 3*s 
    min <- m - 3*s 
    suj_avg_list[[cond]][[is.na(suj_avg_list[[cond]][,col]),col]] <- 999
    suj_avg_list[[cond]][(suj_avg_list[[cond]][,col] < min | suj_avg_list[[cond]][,col] > max), col] <- NA
  }
}

High Load

Here, we are just looking at the connectivity across the task at high load. First, we’re going to just plot the connectivity matrices to get a sense of how things look at the network level.

Connectivity Matrices

networks <- c("FPCN", "FPCN_PFC", "FPCN_Par","DMN", "HPC", "HPC_Ant","HPC_Med", "HPC_Post", "FFA")
cond_list <- c("Cue", "Delay", "Probe")

for (cond in c(2,4,6)){
  calc_network_avg_matrix(avg_beta_series[[cond]]) %>% 
    as_tibble() %>%
    rowid_to_column("X") %>%
    gather(key="Y", value="Z", -1) %>%
    #mutate(Y=as.numeric(gsub("V","",Y))) %>%
    ggplot()+
    geom_tile(aes(x=X,y=Y, fill=Z))+
    theme_classic()+
    theme(aspect.ratio=1, 
          axis.line=element_blank(),
          axis.ticks = element_blank(), 
          axis.text.x = element_text(angle=45, hjust=1))+
    scale_x_continuous(breaks = c(1:9), labels=networks)+
    scale_fill_gradient(limits = c(-1,0))+
    labs(x="Network 1", y="Network 2", fill = "Connectivity", title = cond_list[cond/2]) -> temp_plot
  print(temp_plot)
  
}

Directly compare across task period

Next, let’s directly compare across task period. If we actually compare the values, we’re not seeing any difference across time.

avg_data %>% 
  select(PTID, FPCN_FPCN, DMN_DMN, HPC_HPC, FFA_FFA) %>%
  melt(id.vars="PTID") %>% 
  filter(grepl("load3", PTID)) %>% 
  ggplot(aes(x=variable, y =value, fill = PTID))+
  geom_bar(stat="identity", position = "dodge")+
  ggtitle("Within Network Connectivity")+
  ylab("Connectivity")+
  xlab("Network")+
  theme_classic()

avg_data %>% 
  select(PTID, FPCN_DMN, FPCN_HPC, FPCN_FFA) %>%
  melt(id.vars="PTID") %>% 
  filter(grepl("load3", PTID)) %>% 
  ggplot(aes(x=variable, y =value, fill = PTID))+
  geom_bar(stat="identity", position = "dodge")+
  ggtitle("FPCN Connectivity")+
  ylab("Connectivity")+
  xlab("Network")+
  theme_classic()

avg_data %>% 
  select(PTID, FPCN_DMN, DMN_HPC, DMN_FFA) %>%
  melt(id.vars="PTID") %>% 
  filter(grepl("load3", PTID)) %>% 
  ggplot(aes(x=variable, y =value, fill = PTID))+
  geom_bar(stat="identity", position = "dodge")+
  ggtitle("DMN Connectivity")+
  ylab("Connectivity")+
  xlab("Network")+
  theme_classic()

avg_data %>% 
  select(PTID, FPCN_HPC, DMN_HPC, HPC_FFA) %>%
  melt(id.vars="PTID") %>% 
  filter(grepl("load3", PTID)) %>% 
  ggplot(aes(x=variable, y =value, fill = PTID))+
  geom_bar(stat="identity", position = "dodge")+
  ggtitle("HPC Connectivity")+
  ylab("Connectivity")+
  xlab("Network")+
  theme_classic()

avg_data %>% 
  select(PTID, FPCN_HPC_Ant, DMN_HPC_Ant, FFA_HPC_Ant) %>%
  melt(id.vars="PTID") %>% 
  filter(grepl("load3", PTID)) %>% 
  ggplot(aes(x=variable, y =value, fill = PTID))+
  geom_bar(stat="identity", position = "dodge")+
  ggtitle("Anterior HPC Connectivity")+
  ylab("Connectivity")+
  xlab("Network")+
  theme_classic()

avg_data %>% 
  select(PTID, FPCN_HPC_Med, DMN_HPC_Med, FFA_HPC_Med) %>%
  melt(id.vars="PTID") %>% 
  filter(grepl("load3", PTID)) %>% 
  ggplot(aes(x=variable, y =value, fill = PTID))+
  geom_bar(stat="identity", position = "dodge")+
  ggtitle("Medial HPC Connectivity")+
  ylab("Connectivity")+
  xlab("Network")+
  theme_classic()

avg_data %>% 
  select(PTID, FPCN_HPC_Post, DMN_HPC_Post, FFA_HPC_Post) %>%
  melt(id.vars="PTID") %>% 
  filter(grepl("load3", PTID)) %>% 
  ggplot(aes(x=variable, y =value, fill = PTID))+
  geom_bar(stat="identity", position = "dodge")+
  ggtitle("Posterior HPC Connectivity")+
  ylab("Connectivity")+
  xlab("Network")+
  theme_classic()

avg_data %>% 
  select(PTID, FPCN_FFA, DMN_FFA, HPC_FFA) %>%
  melt(id.vars="PTID") %>% 
  filter(grepl("load3", PTID)) %>% 
  ggplot(aes(x=variable, y =value, fill = PTID))+
  geom_bar(stat="identity", position = "dodge")+
  ggtitle("FFA Connectivity")+
  ylab("Connectivity")+
  xlab("Network")+
  theme_classic()

for (roi in seq.int(2,34)){
  
  temp_data <- data.frame(PTID = suj_avg_list[[1]]$PTID,
                          cue = suj_avg_list[["cue_load3"]][,roi], 
                          delay = suj_avg_list[["probe_load3"]][,roi], 
                          probe = suj_avg_list[["probe_load3"]][,roi])
  
  temp_data <- melt(temp_data, id.vars = "PTID")
  colnames(temp_data) <- c("PTID", "task_period", "connectivity")
  print(colnames(suj_avg_list[[1]][roi]))
  print(summary(aov(connectivity ~ task_period + Error(PTID), data = temp_data)))
  
}
## [1] "FPCN_FPCN"
## 
## Error: PTID
##           Df Sum Sq Mean Sq F value Pr(>F)
## Residuals  1 0.2389  0.2389               
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2   0.05 0.02446   0.366  0.694
## Residuals   494  33.00 0.06680               
## [1] "DMN_DMN"
## 
## Error: PTID
##           Df Sum Sq Mean Sq F value Pr(>F)
## Residuals  1 0.2881  0.2881               
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2  0.007 0.00350   0.071  0.931
## Residuals   494 24.308 0.04921               
## [1] "HPC_HPC"
## 
## Error: PTID
##           Df   Sum Sq  Mean Sq F value Pr(>F)
## Residuals  1 0.007505 0.007505               
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2   0.76  0.3795   0.792  0.454
## Residuals   494 236.76  0.4793               
## [1] "FFA_FFA"
## 
## Error: PTID
##           Df Sum Sq Mean Sq F value Pr(>F)
## Residuals  1 0.0903  0.0903               
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2     14   6.991   0.651  0.522
## Residuals   494   5307  10.743               
## [1] "FPCN_DMN"
## 
## Error: PTID
##           Df Sum Sq Mean Sq F value Pr(>F)
## Residuals  1  0.353   0.353               
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2  0.015 0.00768   0.125  0.882
## Residuals   494 30.311 0.06136               
## [1] "FPCN_HPC"
## 
## Error: PTID
##           Df Sum Sq Mean Sq F value Pr(>F)
## Residuals  1 0.5647  0.5647               
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2   0.03 0.01283   0.185  0.831
## Residuals   494  34.18 0.06920               
## [1] "FPCN_FFA"
## 
## Error: PTID
##           Df  Sum Sq Mean Sq F value Pr(>F)
## Residuals  1 0.06543 0.06543               
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2   0.00 0.00028   0.003  0.997
## Residuals   494  46.68 0.09449               
## [1] "DMN_HPC"
## 
## Error: PTID
##           Df  Sum Sq Mean Sq F value Pr(>F)
## Residuals  1 0.07368 0.07368               
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2  0.052 0.02576   0.431   0.65
## Residuals   494 29.528 0.05977               
## [1] "DMN_FFA"
## 
## Error: PTID
##           Df Sum Sq Mean Sq F value Pr(>F)
## Residuals  1 0.1961  0.1961               
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2   0.36 0.18211    1.86  0.157
## Residuals   494  48.37 0.09792               
## [1] "HPC_FFA"
## 
## Error: PTID
##           Df Sum Sq Mean Sq F value Pr(>F)
## Residuals  1 0.2983  0.2983               
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2   0.00 0.00189   0.012  0.988
## Residuals   494  74.71 0.15124               
## [1] "FPCN_PFC_FPCN_PFC"
## 
## Error: PTID
##           Df Sum Sq Mean Sq F value Pr(>F)
## Residuals  1 0.2085  0.2085               
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2   0.09 0.04373   0.548  0.578
## Residuals   494  39.40 0.07977               
## [1] "FPCN_PFC_FPCN_Par"
## 
## Error: PTID
##           Df Sum Sq Mean Sq F value Pr(>F)
## Residuals  1 0.2977  0.2977               
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2   0.07 0.03426   0.476  0.622
## Residuals   494  35.58 0.07203               
## [1] "FPCN_PFC_DMN"
## 
## Error: PTID
##           Df Sum Sq Mean Sq F value Pr(>F)
## Residuals  1 0.3616  0.3616               
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2   0.01 0.00497   0.075  0.928
## Residuals   494  32.60 0.06599               
## [1] "FPCN_PFC_HPC"
## 
## Error: PTID
##           Df Sum Sq Mean Sq F value Pr(>F)
## Residuals  1 0.5115  0.5115               
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2   0.03 0.01475   0.208  0.813
## Residuals   494  35.10 0.07105               
## [1] "FPCN_PFC_FFA"
## 
## Error: PTID
##           Df Sum Sq Mean Sq F value Pr(>F)
## Residuals  1 0.1236  0.1236               
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2    0.0 0.00007   0.001  0.999
## Residuals   494   52.5 0.10628               
## [1] "FPCN_Par_DMN"
## 
## Error: PTID
##           Df Sum Sq Mean Sq F value Pr(>F)
## Residuals  1 0.3916  0.3916               
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2   0.05 0.02611   0.362  0.696
## Residuals   494  35.62 0.07210               
## [1] "FPCN_Par_HPC"
## 
## Error: PTID
##           Df Sum Sq Mean Sq F value Pr(>F)
## Residuals  1 0.9424  0.9424               
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2   0.06 0.03240   0.338  0.713
## Residuals   494  47.36 0.09587               
## [1] "FPCN_Par_FFA"
## 
## Error: PTID
##           Df  Sum Sq Mean Sq F value Pr(>F)
## Residuals  1 0.04776 0.04776               
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2   0.01 0.00458   0.034  0.966
## Residuals   494  65.91 0.13342               
## [1] "FPCN_HPC_Ant"
## 
## Error: PTID
##           Df Sum Sq Mean Sq F value Pr(>F)
## Residuals  1 0.6632  0.6632               
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2   0.05 0.02458   0.236   0.79
## Residuals   494  51.45 0.10415               
## [1] "FPCN_PFC_HPC_Ant"
## 
## Error: PTID
##           Df Sum Sq Mean Sq F value Pr(>F)
## Residuals  1 0.5194  0.5194               
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2   0.08 0.03992    0.34  0.712
## Residuals   494  58.04 0.11750               
## [1] "FPCN_Par_HPC_Ant"
## 
## Error: PTID
##           Df Sum Sq Mean Sq F value Pr(>F)
## Residuals  1  1.298   1.298               
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2   0.12 0.06009    0.42  0.657
## Residuals   494  70.69 0.14310               
## [1] "DMN_HPC_Ant"
## 
## Error: PTID
##           Df Sum Sq Mean Sq F value Pr(>F)
## Residuals  1 0.2937  0.2937               
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2   0.06 0.02867   0.286  0.751
## Residuals   494  49.55 0.10030               
## [1] "FFA_HPC_Ant"
## 
## Error: PTID
##           Df Sum Sq Mean Sq F value Pr(>F)
## Residuals  1 0.8864  0.8864               
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2    0.0 0.00211   0.009  0.991
## Residuals   494  109.9 0.22246               
## [1] "FPCN_HPC_Med"
## 
## Error: PTID
##           Df Sum Sq Mean Sq F value Pr(>F)
## Residuals  1 0.9614  0.9614               
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2   0.04 0.01903   0.201  0.818
## Residuals   494  46.66 0.09446               
## [1] "FPCN_PFC_HPC_Med"
## 
## Error: PTID
##           Df Sum Sq Mean Sq F value Pr(>F)
## Residuals  1 0.8535  0.8535               
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2   0.03 0.01515    0.15  0.861
## Residuals   494  49.84 0.10088               
## [1] "FPCN_Par_HPC_Med"
## 
## Error: PTID
##           Df Sum Sq Mean Sq F value Pr(>F)
## Residuals  1  1.623   1.623               
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2   0.10 0.05244   0.427  0.652
## Residuals   494  60.61 0.12270               
## [1] "DMN_HPC_Med"
## 
## Error: PTID
##           Df Sum Sq Mean Sq F value Pr(>F)
## Residuals  1 0.1566  0.1566               
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2   0.03 0.01549   0.232  0.793
## Residuals   494  33.04 0.06689               
## [1] "FFA_HPC_Med"
## 
## Error: PTID
##           Df Sum Sq Mean Sq F value Pr(>F)
## Residuals  1 0.3276  0.3276               
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2   0.00 0.00006       0      1
## Residuals   494  97.55 0.19747               
## [1] "FPCN_HPC_Post"
## 
## Error: PTID
##           Df Sum Sq Mean Sq F value Pr(>F)
## Residuals  1 0.2241  0.2241               
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2   0.00 0.00002       0      1
## Residuals   494  49.58 0.10036               
## [1] "FPCN_PFC_HPC_Post"
## 
## Error: PTID
##           Df Sum Sq Mean Sq F value Pr(>F)
## Residuals  1 0.2404  0.2404               
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2   0.00 0.00027   0.002  0.998
## Residuals   494  53.48 0.10826               
## [1] "FPCN_Par_HPC_Post"
## 
## Error: PTID
##           Df Sum Sq Mean Sq F value Pr(>F)
## Residuals  1 0.2976  0.2976               
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2   0.00 0.00004       0      1
## Residuals   494  73.15 0.14807               
## [1] "DMN_HPC_Post"
## 
## Error: PTID
##           Df   Sum Sq  Mean Sq F value Pr(>F)
## Residuals  1 0.002935 0.002935               
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2   0.10 0.05209   0.568  0.567
## Residuals   494  45.29 0.09168               
## [1] "FFA_HPC_Post"
## 
## Error: PTID
##           Df  Sum Sq Mean Sq F value Pr(>F)
## Residuals  1 0.03597 0.03597               
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2   0.02 0.01182   0.048  0.953
## Residuals   494 121.58 0.24611

Split by groups

If we plot by WM capacity group, we’re not seeing any significant differences either.

plot_list_L3 <- list()

for (cond in seq.int(7,9)){
  
  cond_list <- list()
  
  suj_avg_list[[cond]] %>% 
    melt() %>%
    filter(variable %in% c("FPCN_FPCN", "DMN_DMN", "HPC_HPC", "FFA_FFA")) %>%
    group_by(level, variable) %>% 
    summarise(average = mean(value, na.rm=TRUE), se_val = se(value), se_min = average-se_val, se_max = average+se_val) %>% 
    mutate(level = factor(level, levels = c("low", "med", "high"))) %>%
    ggplot(aes(x=variable, y = average, fill=level)) + 
    geom_bar(stat="identity", position = "dodge")+
    geom_errorbar(aes(ymin = se_min, ymax = se_max), width=0.1, position = position_dodge(0.9))+
    xlab("Regions")+
    ylab("Average Connectivity")+
    ggtitle(paste(names(suj_avg_list)[cond]))+
    theme_classic()+
    theme(aspect.ratio=1, axis.text.x = element_text(angle = 45, vjust = 0.5)) -> cond_list[["within"]]
  
  suj_avg_list[[cond]] %>% 
    melt() %>%
    filter(variable %in% c("FPCN_DMN", "FPCN_HPC", "FPCN_FFA")) %>%
    group_by(level, variable) %>% 
    summarise(average = mean(value, na.rm=TRUE), se_val = se(value), se_min = average-se_val, se_max = average+se_val) %>% 
    mutate(level = factor(level, levels = c("low", "med", "high"))) %>%
    ggplot(aes(x=variable, y = average, fill=level)) + 
    geom_bar(stat="identity", position = "dodge")+
    geom_errorbar(aes(ymin = se_min, ymax = se_max), width=0.1, position = position_dodge(0.9))+
    xlab("Regions")+
    ylab("Average Connectivity")+
    ggtitle(paste(names(suj_avg_list)[cond]))+
    theme_classic()+
    theme(aspect.ratio=1, axis.text.x = element_text(angle = 45, vjust = 0.5)) -> cond_list[["FPCN"]]
  
  suj_avg_list[[cond]] %>% 
    melt() %>%
    filter(variable %in% c("FPCN_DMN", "DMN_HPC","DMN_FFA")) %>%
    group_by(level, variable) %>% 
    summarise(average = mean(value, na.rm=TRUE), se_val = se(value), se_min = average-se_val, se_max = average+se_val) %>% 
    mutate(level = factor(level, levels = c("low", "med", "high"))) %>%
    ggplot(aes(x=variable, y = average, fill=level)) + 
    geom_bar(stat="identity", position = "dodge")+
    geom_errorbar(aes(ymin = se_min, ymax = se_max), width=0.1, position = position_dodge(0.9))+
    xlab("Regions")+
    ylab("Average Connectivity")+
    ggtitle(paste(names(suj_avg_list)[cond]))+
    theme_classic()+
    theme(aspect.ratio=1, axis.text.x = element_text(angle = 45, vjust = 0.5)) -> cond_list[["DMN"]]
  
  suj_avg_list[[cond]] %>% 
    melt() %>%
    filter(variable %in% c("FPCN_HPC", "DMN_HPC","HPC_FFA")) %>%
    group_by(level, variable) %>% 
    summarise(average = mean(value, na.rm=TRUE), se_val = se(value), se_min = average-se_val, se_max = average+se_val) %>% 
    mutate(level = factor(level, levels = c("low", "med", "high"))) %>%
    ggplot(aes(x=variable, y = average, fill=level)) + 
    geom_bar(stat="identity", position = "dodge")+
    geom_errorbar(aes(ymin = se_min, ymax = se_max), width=0.1, position = position_dodge(0.9))+
    xlab("Regions")+
    ylab("Average Connectivity")+
    ggtitle(paste(names(suj_avg_list)[cond]))+
    theme_classic()+
    theme(aspect.ratio=1, axis.text.x = element_text(angle = 45, vjust = 0.5)) -> cond_list[["HPC"]]
  
  suj_avg_list[[cond]] %>% 
    melt() %>%
    filter(variable %in% c("FPCN_HPC_Ant", "DMN_HPC_Ant","FFA_HPC_Ant")) %>%
    group_by(level, variable) %>% 
    summarise(average = mean(value, na.rm=TRUE), se_val = se(value), se_min = average-se_val, se_max = average+se_val) %>% 
    mutate(level = factor(level, levels = c("low", "med", "high"))) %>%
    ggplot(aes(x=variable, y = average, fill=level)) + 
    geom_bar(stat="identity", position = "dodge")+
    geom_errorbar(aes(ymin = se_min, ymax = se_max), width=0.1, position = position_dodge(0.9))+
    xlab("Regions")+
    ylab("Average Connectivity")+
    ggtitle(paste(names(suj_avg_list)[cond]))+
    theme_classic()+
    theme(aspect.ratio=1, axis.text.x = element_text(angle = 45, vjust = 0.5)) -> cond_list[["HPC_Ant"]]
  
  suj_avg_list[[cond]] %>% 
    melt() %>%
    filter(variable %in% c("FPCN_HPC_Med", "DMN_HPC_Med","FFA_HPC_Med")) %>%
    group_by(level, variable) %>% 
    summarise(average = mean(value, na.rm=TRUE), se_val = se(value), se_min = average-se_val, se_max = average+se_val) %>% 
    mutate(level = factor(level, levels = c("low", "med", "high"))) %>%
    ggplot(aes(x=variable, y = average, fill=level)) + 
    geom_bar(stat="identity", position = "dodge")+
    geom_errorbar(aes(ymin = se_min, ymax = se_max), width=0.1, position = position_dodge(0.9))+
    xlab("Regions")+
    ylab("Average Connectivity")+
    ggtitle(paste(names(suj_avg_list)[cond]))+
    theme_classic()+
    theme(aspect.ratio=1, axis.text.x = element_text(angle = 45, vjust = 0.5)) -> cond_list[["HPC_Med"]]
  
  suj_avg_list[[cond]] %>% 
    melt() %>%
    filter(variable %in% c("FPCN_HPC_Post", "DMN_HPC_Post","FFA_HPC_Post")) %>%
    group_by(level, variable) %>% 
    summarise(average = mean(value, na.rm=TRUE), se_val = se(value), se_min = average-se_val, se_max = average+se_val) %>% 
    mutate(level = factor(level, levels = c("low", "Post", "high"))) %>%
    ggplot(aes(x=variable, y = average, fill=level)) + 
    geom_bar(stat="identity", position = "dodge")+
    geom_errorbar(aes(ymin = se_min, ymax = se_max), width=0.1, position = position_dodge(0.9))+
    xlab("Regions")+
    ylab("Average Connectivity")+
    ggtitle(paste(names(suj_avg_list)[cond]))+
    theme_classic()+
    theme(aspect.ratio=1, axis.text.x = element_text(angle = 45, vjust = 0.5)) -> cond_list[["HPC_Post"]]
  
  suj_avg_list[[cond]] %>% 
    melt() %>%
    filter(variable %in% c("FPCN_HPC", "DMN_HPC","HPC_FFA")) %>%
    group_by(level, variable) %>% 
    summarise(average = mean(value, na.rm=TRUE), se_val = se(value), se_min = average-se_val, se_max = average+se_val) %>% 
    mutate(level = factor(level, levels = c("low", "med", "high"))) %>%
    ggplot(aes(x=variable, y = average, fill=level)) + 
    geom_bar(stat="identity", position = "dodge")+
    geom_errorbar(aes(ymin = se_min, ymax = se_max), width=0.1, position = position_dodge(0.9))+
    xlab("Regions")+
    ylab("Average Connectivity")+
    ggtitle(paste(names(suj_avg_list)[cond]))+
    theme_classic()+
    theme(aspect.ratio=1, axis.text.x = element_text(angle = 45, vjust = 0.5)) -> cond_list[["HPC"]]
  
  suj_avg_list[[cond]] %>% 
    melt() %>%
    filter(variable %in% c("FPCN_FFA", "DMN_FFA","HPC_FFA")) %>%
    group_by(level, variable) %>% 
    summarise(average = mean(value, na.rm=TRUE), se_val = se(value), se_min = average-se_val, se_max = average+se_val) %>% 
    mutate(level = factor(level, levels = c("low", "med", "high"))) %>%
    ggplot(aes(x=variable, y = average, fill=level)) + 
    geom_bar(stat="identity", position = "dodge")+
    geom_errorbar(aes(ymin = se_min, ymax = se_max), width=0.1, position = position_dodge(0.9))+
    xlab("Regions")+
    ylab("Average Connectivity")+
    ggtitle(paste(names(suj_avg_list)[cond]))+
    theme_classic()+
    theme(aspect.ratio=1, axis.text.x = element_text(angle = 45, vjust = 0.5)) -> cond_list[["FFA"]]
  plot_list_L3[[names(suj_avg_list)[cond]]] <- cond_list
}

plot_list_L3[["cue_load_effect"]][["within"]] + plot_list_L3[["delay_load_effect"]][["within"]] + plot_list_L3[["probe_load_effect"]][["within"]] +
  plot_layout(guides="collect")+
  plot_annotation(title = "Within Network Connectivity")

plot_list_L3[["cue_load_effect"]][["FPCN"]] + plot_list_L3[["delay_load_effect"]][["FPCN"]] + plot_list_L3[["probe_load_effect"]][["FPCN"]] +
  plot_layout(guides="collect")+
  plot_annotation(title = "FPCN Connectivity")

plot_list_L3[["cue_load_effect"]][["DMN"]] + plot_list_L3[["delay_load_effect"]][["DMN"]] + 
  plot_list_L3[["probe_load_effect"]][["DMN"]] +
  plot_layout(guides="collect")+
  plot_annotation(title = "DMN Connectivity")

plot_list_L3[["cue_load_effect"]][["HPC"]] + plot_list_L3[["delay_load_effect"]][["HPC"]] + 
  plot_list_L3[["probe_load_effect"]][["HPC"]] +
  plot_layout(guides="collect")+
  plot_annotation(title = "HPC Connectivity")

plot_list_L3[["cue_load_effect"]][["HPC_Ant"]] + plot_list_L3[["delay_load_effect"]][["HPC_Ant"]] + 
  plot_list_L3[["probe_load_effect"]][["HPC_Ant"]] +
  plot_layout(guides="collect")+
  plot_annotation(title = "Anterior HPC Connectivity")

plot_list_L3[["cue_load_effect"]][["HPC_Med"]] + plot_list_L3[["delay_load_effect"]][["HPC_Med"]] + 
  plot_list_L3[["probe_load_effect"]][["HPC_Med"]] +
  plot_layout(guides="collect")+
  plot_annotation(title = "Medial HPC Connectivity")

plot_list_L3[["cue_load_effect"]][["HPC_Post"]] + plot_list_L3[["delay_load_effect"]][["HPC_Post"]] + 
  plot_list_L3[["probe_load_effect"]][["HPC_Post"]] +
  plot_layout(guides="collect")+
  plot_annotation(title = "Posterior HPC Connectivity")

plot_list_L3[["cue_load_effect"]][["FFA"]] + plot_list_L3[["delay_load_effect"]][["FFA"]] + 
  plot_list_L3[["probe_load_effect"]][["FFA"]] +
  plot_layout(guides="collect")+
  plot_annotation(title = "FFA Connectivity")

for (cond in seq.int(1,3)){
  print(names(suj_avg_list)[cond])
  anova_results <- purrr::map(suj_avg_list[[cond]][,2:34], ~aov(.x ~ suj_avg_list[[cond]]$level ))
  for (measure in seq.int(1,33)){
    print(colnames(suj_avg_list[[cond]])[measure+1])
    print(summary(anova_results[[measure]]))
  }
}
## [1] "cue_load3"
## [1] "FPCN_FPCN"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.074 0.03717   0.419  0.658
## Residuals                  163 14.446 0.08863               
## 1 observation deleted due to missingness
## [1] "DMN_DMN"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.033 0.01672   0.317  0.729
## Residuals                  163  8.602 0.05277               
## 1 observation deleted due to missingness
## [1] "HPC_HPC"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2   0.60  0.2980   0.707  0.495
## Residuals                  163  68.68  0.4214               
## 1 observation deleted due to missingness
## [1] "FFA_FFA"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2   10.1   5.056   0.517  0.598
## Residuals                  163 1595.5   9.788               
## 1 observation deleted due to missingness
## [1] "FPCN_DMN"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.017 0.00848   0.121  0.886
## Residuals                  163 11.410 0.07000               
## 1 observation deleted due to missingness
## [1] "FPCN_HPC"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.039 0.01942   0.272  0.762
## Residuals                  163 11.638 0.07140               
## 1 observation deleted due to missingness
## [1] "FPCN_FFA"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.058 0.02918   0.233  0.792
## Residuals                  163 20.403 0.12517               
## 1 observation deleted due to missingness
## [1] "DMN_HPC"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.004 0.00179   0.032  0.969
## Residuals                  163  9.139 0.05606               
## 1 observation deleted due to missingness
## [1] "DMN_FFA"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.057 0.02856   0.287  0.751
## Residuals                  163 16.212 0.09946               
## 1 observation deleted due to missingness
## [1] "HPC_FFA"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.024 0.01188   0.095  0.909
## Residuals                  163 20.376 0.12501               
## 1 observation deleted due to missingness
## [1] "FPCN_PFC_FPCN_PFC"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2   0.26 0.12998   1.318  0.271
## Residuals                  163  16.07 0.09861               
## 1 observation deleted due to missingness
## [1] "FPCN_PFC_FPCN_Par"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.057 0.02839   0.305  0.737
## Residuals                  163 15.167 0.09305               
## 1 observation deleted due to missingness
## [1] "FPCN_PFC_DMN"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.024 0.01182   0.162  0.851
## Residuals                  163 11.921 0.07314               
## 1 observation deleted due to missingness
## [1] "FPCN_PFC_HPC"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.067 0.03358   0.432   0.65
## Residuals                  163 12.676 0.07777               
## 1 observation deleted due to missingness
## [1] "FPCN_PFC_FFA"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.021 0.01075   0.079  0.924
## Residuals                  163 22.231 0.13639               
## 1 observation deleted due to missingness
## [1] "FPCN_Par_DMN"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.013 0.00643   0.089  0.915
## Residuals                  163 11.784 0.07229               
## 1 observation deleted due to missingness
## [1] "FPCN_Par_HPC"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.037 0.01838   0.235  0.791
## Residuals                  163 12.733 0.07812               
## 1 observation deleted due to missingness
## [1] "FPCN_Par_FFA"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2   0.14  0.0701    0.48  0.619
## Residuals                  163  23.78  0.1459               
## 1 observation deleted due to missingness
## [1] "FPCN_HPC_Ant"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.005 0.00233   0.021   0.98
## Residuals                  163 18.371 0.11271               
## 1 observation deleted due to missingness
## [1] "FPCN_PFC_HPC_Ant"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.021 0.01047   0.084   0.92
## Residuals                  163 20.391 0.12510               
## 1 observation deleted due to missingness
## [1] "FPCN_Par_HPC_Ant"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.033 0.01665   0.126  0.882
## Residuals                  163 21.617 0.13262               
## 1 observation deleted due to missingness
## [1] "DMN_HPC_Ant"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.008 0.00381   0.046  0.955
## Residuals                  163 13.380 0.08209               
## 1 observation deleted due to missingness
## [1] "FFA_HPC_Ant"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.127 0.06338   0.344  0.709
## Residuals                  163 29.992 0.18400               
## 1 observation deleted due to missingness
## [1] "FPCN_HPC_Med"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.069  0.0344   0.292  0.748
## Residuals                  163 19.234  0.1180               
## 1 observation deleted due to missingness
## [1] "FPCN_PFC_HPC_Med"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.113 0.05667   0.449  0.639
## Residuals                  163 20.563 0.12615               
## 1 observation deleted due to missingness
## [1] "FPCN_Par_HPC_Med"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2   0.07 0.03486   0.275   0.76
## Residuals                  163  20.63 0.12658               
## 1 observation deleted due to missingness
## [1] "DMN_HPC_Med"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2   0.00 0.00011   0.002  0.998
## Residuals                  163  11.43 0.07012               
## 1 observation deleted due to missingness
## [1] "FFA_HPC_Med"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.141 0.07044   0.393  0.675
## Residuals                  163 29.192 0.17909               
## 1 observation deleted due to missingness
## [1] "FPCN_HPC_Post"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.112  0.0558   0.437  0.647
## Residuals                  163 20.808  0.1277               
## 1 observation deleted due to missingness
## [1] "FPCN_PFC_HPC_Post"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.129 0.06458   0.465  0.629
## Residuals                  163 22.622 0.13878               
## 1 observation deleted due to missingness
## [1] "FPCN_Par_HPC_Post"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2   0.11  0.0550   0.409  0.665
## Residuals                  163  21.94  0.1346               
## 1 observation deleted due to missingness
## [1] "DMN_HPC_Post"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2   0.02 0.00989   0.111  0.895
## Residuals                  163  14.57 0.08940               
## 1 observation deleted due to missingness
## [1] "FFA_HPC_Post"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2   0.19 0.09411   0.468  0.627
## Residuals                  163  32.79 0.20115               
## 1 observation deleted due to missingness
## [1] "delay_load3"
## [1] "FPCN_FPCN"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.009 0.00450   0.076  0.927
## Residuals                  163  9.622 0.05903               
## 1 observation deleted due to missingness
## [1] "DMN_DMN"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.056 0.02818   0.573  0.565
## Residuals                  163  8.018 0.04919               
## 1 observation deleted due to missingness
## [1] "HPC_HPC"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2   0.41  0.2059   0.521  0.595
## Residuals                  163  64.45  0.3954               
## 1 observation deleted due to missingness
## [1] "FFA_FFA"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2     41   20.50   1.932  0.148
## Residuals                  163   1729   10.61               
## 1 observation deleted due to missingness
## [1] "FPCN_DMN"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.019 0.00954   0.144  0.866
## Residuals                  163 10.777 0.06611               
## 1 observation deleted due to missingness
## [1] "FPCN_HPC"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.079 0.03954   0.565   0.57
## Residuals                  163 11.416 0.07003               
## 1 observation deleted due to missingness
## [1] "FPCN_FFA"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.074 0.03697   0.485  0.617
## Residuals                  163 12.428 0.07624               
## 1 observation deleted due to missingness
## [1] "DMN_HPC"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.056 0.02802   0.523  0.594
## Residuals                  163  8.725 0.05353               
## 1 observation deleted due to missingness
## [1] "DMN_FFA"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.149 0.07446   0.851  0.429
## Residuals                  163 14.270 0.08755               
## 1 observation deleted due to missingness
## [1] "HPC_FFA"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.163 0.08129    0.79  0.456
## Residuals                  163 16.778 0.10293               
## 1 observation deleted due to missingness
## [1] "FPCN_PFC_FPCN_PFC"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.014 0.00715   0.099  0.905
## Residuals                  163 11.722 0.07191               
## 1 observation deleted due to missingness
## [1] "FPCN_PFC_FPCN_Par"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.029 0.01430   0.244  0.784
## Residuals                  163  9.541 0.05853               
## 1 observation deleted due to missingness
## [1] "FPCN_PFC_DMN"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.014 0.00675   0.093  0.911
## Residuals                  163 11.814 0.07248               
## 1 observation deleted due to missingness
## [1] "FPCN_PFC_HPC"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.091 0.04550   0.605  0.547
## Residuals                  163 12.253 0.07517               
## 1 observation deleted due to missingness
## [1] "FPCN_PFC_FFA"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.112 0.05597   0.692  0.502
## Residuals                  163 13.176 0.08084               
## 1 observation deleted due to missingness
## [1] "FPCN_Par_DMN"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.026 0.01292    0.19  0.827
## Residuals                  163 11.065 0.06788               
## 1 observation deleted due to missingness
## [1] "FPCN_Par_HPC"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.056 0.02793   0.366  0.694
## Residuals                  163 12.441 0.07632               
## 1 observation deleted due to missingness
## [1] "FPCN_Par_FFA"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.103 0.05135   0.596  0.552
## Residuals                  163 14.045 0.08616               
## 1 observation deleted due to missingness
## [1] "FPCN_HPC_Ant"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.155 0.07734   1.068  0.346
## Residuals                  163 11.807 0.07244               
## 1 observation deleted due to missingness
## [1] "FPCN_PFC_HPC_Ant"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.172  0.0861   1.091  0.338
## Residuals                  163 12.861  0.0789               
## 1 observation deleted due to missingness
## [1] "FPCN_Par_HPC_Ant"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.092 0.04575   0.573  0.565
## Residuals                  163 13.027 0.07992               
## 1 observation deleted due to missingness
## [1] "DMN_HPC_Ant"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.123 0.06159   1.086   0.34
## Residuals                  163  9.246 0.05673               
## 1 observation deleted due to missingness
## [1] "FFA_HPC_Ant"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.443  0.2214   1.826  0.164
## Residuals                  163 19.762  0.1212               
## 1 observation deleted due to missingness
## [1] "FPCN_HPC_Med"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.189 0.09446   1.148   0.32
## Residuals                  163 13.414 0.08230               
## 1 observation deleted due to missingness
## [1] "FPCN_PFC_HPC_Med"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.201 0.10036   1.113  0.331
## Residuals                  163 14.698 0.09017               
## 1 observation deleted due to missingness
## [1] "FPCN_Par_HPC_Med"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.143 0.07146   0.797  0.452
## Residuals                  163 14.609 0.08962               
## 1 observation deleted due to missingness
## [1] "DMN_HPC_Med"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.121 0.06067   1.045  0.354
## Residuals                  163  9.464 0.05806               
## 1 observation deleted due to missingness
## [1] "FFA_HPC_Med"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.058 0.02881   0.223    0.8
## Residuals                  163 21.063 0.12922               
## 1 observation deleted due to missingness
## [1] "FPCN_HPC_Post"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.007 0.00352   0.038  0.962
## Residuals                  163 14.999 0.09202               
## 1 observation deleted due to missingness
## [1] "FPCN_PFC_HPC_Post"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.024 0.01182   0.116  0.891
## Residuals                  163 16.650 0.10215               
## 1 observation deleted due to missingness
## [1] "FPCN_Par_HPC_Post"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.002 0.00082   0.008  0.992
## Residuals                  163 16.468 0.10103               
## 1 observation deleted due to missingness
## [1] "DMN_HPC_Post"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.006 0.00279   0.036  0.965
## Residuals                  163 12.655 0.07764               
## 1 observation deleted due to missingness
## [1] "FFA_HPC_Post"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.066 0.03301    0.24  0.787
## Residuals                  163 22.376 0.13728               
## 1 observation deleted due to missingness
## [1] "probe_load3"
## [1] "FPCN_FPCN"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.018 0.00907   0.158  0.854
## Residuals                  163  9.341 0.05730               
## 1 observation deleted due to missingness
## [1] "DMN_DMN"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.105 0.05242   1.085   0.34
## Residuals                  163  7.875 0.04831               
## 1 observation deleted due to missingness
## [1] "HPC_HPC"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2   0.05  0.0270   0.053  0.949
## Residuals                  163  83.69  0.5135               
## 1 observation deleted due to missingness
## [1] "FFA_FFA"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2   17.3   8.658    0.77  0.465
## Residuals                  163 1833.5  11.248               
## 1 observation deleted due to missingness
## [1] "FPCN_DMN"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.089 0.04448   0.761  0.469
## Residuals                  163  9.529 0.05846               
## 1 observation deleted due to missingness
## [1] "FPCN_HPC"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.122 0.06101   0.871   0.42
## Residuals                  163 11.414 0.07002               
## 1 observation deleted due to missingness
## [1] "FPCN_FFA"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.028 0.01378   0.171  0.843
## Residuals                  163 13.115 0.08046               
## 1 observation deleted due to missingness
## [1] "DMN_HPC"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.148 0.07385   1.194  0.306
## Residuals                  163 10.082 0.06185               
## 1 observation deleted due to missingness
## [1] "DMN_FFA"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.004 0.00224   0.023  0.978
## Residuals                  163 16.145 0.09905               
## 1 observation deleted due to missingness
## [1] "HPC_FFA"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.212  0.1059   0.637   0.53
## Residuals                  163 27.093  0.1662               
## 1 observation deleted due to missingness
## [1] "FPCN_PFC_FPCN_PFC"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.027 0.01332   0.187   0.83
## Residuals                  163 11.613 0.07124               
## 1 observation deleted due to missingness
## [1] "FPCN_PFC_FPCN_Par"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.032 0.01605   0.254  0.776
## Residuals                  163 10.296 0.06316               
## 1 observation deleted due to missingness
## [1] "FPCN_PFC_DMN"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2   0.11 0.05492   0.861  0.425
## Residuals                  163  10.40 0.06380               
## 1 observation deleted due to missingness
## [1] "FPCN_PFC_HPC"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.128 0.06411   0.924  0.399
## Residuals                  163 11.306 0.06936               
## 1 observation deleted due to missingness
## [1] "FPCN_PFC_FFA"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.059 0.02957   0.319  0.728
## Residuals                  163 15.127 0.09280               
## 1 observation deleted due to missingness
## [1] "FPCN_Par_DMN"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2   0.05 0.02520   0.341  0.712
## Residuals                  163  12.06 0.07396               
## 1 observation deleted due to missingness
## [1] "FPCN_Par_HPC"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.034 0.01708   0.157  0.855
## Residuals                  163 17.733 0.10879               
## 1 observation deleted due to missingness
## [1] "FPCN_Par_FFA"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.122 0.06082   0.474  0.623
## Residuals                  163 20.896 0.12819               
## 1 observation deleted due to missingness
## [1] "FPCN_HPC_Ant"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.068 0.03413   0.331  0.719
## Residuals                  163 16.802 0.10308               
## 1 observation deleted due to missingness
## [1] "FPCN_PFC_HPC_Ant"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.049 0.02452    0.21  0.811
## Residuals                  163 19.026 0.11673               
## 1 observation deleted due to missingness
## [1] "FPCN_Par_HPC_Ant"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.021 0.01071   0.069  0.933
## Residuals                  163 25.148 0.15428               
## 1 observation deleted due to missingness
## [1] "DMN_HPC_Ant"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.071 0.03527   0.317  0.729
## Residuals                  163 18.158 0.11140               
## 1 observation deleted due to missingness
## [1] "FFA_HPC_Ant"
##                             Df Sum Sq Mean Sq F value Pr(>F)  
## suj_avg_list[[cond]]$level   2   1.49  0.7440   3.122 0.0467 *
## Residuals                  163  38.84  0.2383                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 1 observation deleted due to missingness
## [1] "FPCN_HPC_Med"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.323 0.16151   1.903  0.152
## Residuals                  163 13.837 0.08489               
## 1 observation deleted due to missingness
## [1] "FPCN_PFC_HPC_Med"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.343 0.17150   1.906  0.152
## Residuals                  163 14.664 0.08997               
## 1 observation deleted due to missingness
## [1] "FPCN_Par_HPC_Med"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.195 0.09733   0.771  0.464
## Residuals                  163 20.574 0.12622               
## 1 observation deleted due to missingness
## [1] "DMN_HPC_Med"
##                             Df Sum Sq Mean Sq F value Pr(>F)  
## suj_avg_list[[cond]]$level   2  0.322 0.16085   2.482 0.0867 .
## Residuals                  163 10.564 0.06481                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 1 observation deleted due to missingness
## [1] "FFA_HPC_Med"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2   0.15 0.07388   0.353  0.703
## Residuals                  163  34.12 0.20935               
## 1 observation deleted due to missingness
## [1] "FPCN_HPC_Post"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.101 0.05071   0.576  0.563
## Residuals                  163 14.340 0.08798               
## 1 observation deleted due to missingness
## [1] "FPCN_PFC_HPC_Post"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.153 0.07647   0.813  0.445
## Residuals                  163 15.333 0.09406               
## 1 observation deleted due to missingness
## [1] "FPCN_Par_HPC_Post"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2  0.001 0.00048   0.003  0.997
## Residuals                  163 25.694 0.15763               
## 1 observation deleted due to missingness
## [1] "DMN_HPC_Post"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2   0.16 0.08012    0.86  0.425
## Residuals                  163  15.19 0.09319               
## 1 observation deleted due to missingness
## [1] "FFA_HPC_Post"
##                             Df Sum Sq Mean Sq F value Pr(>F)
## suj_avg_list[[cond]]$level   2   0.01 0.00721   0.027  0.974
## Residuals                  163  44.30 0.27181               
## 1 observation deleted due to missingness

Load Effect

Looking at load effect is more in line with the rest of our fMRI analyses, so let’s look at those. Again, we’re first going to plot the entire network connectivity matrix, to get a sense of the networks as a whole.

Connectivity matrix

for (cond in seq.int(7,9)){
  calc_network_avg_matrix(avg_beta_series[[cond]]) %>% 
    as_tibble() %>%
    rowid_to_column("X") %>%
    gather(key="Y", value="Z", -1) %>%
    ggplot()+
    geom_tile(aes(x=X,y=Y, fill=Z))+
    theme_classic()+
    theme(aspect.ratio=1, 
          axis.line=element_blank(),
          axis.ticks = element_blank(), 
          axis.text.x = element_text(angle=45, hjust=1))+
    scale_x_continuous(breaks = c(1:9), labels=networks)+
    scale_fill_gradient(limits = c(-0.075,0.15))+
    labs(x="Network 1", y="Network 2", fill = "Connectivity", title = cond_list[cond-6]) -> temp_plot
  print(temp_plot)
  
}

Overall, we’re seeing load effects that are significantly different from zero in the parietal regions of the FPCN with the HPC (particularly the medial region) and the FFA during cue, and the FPCN and FFA with the anterior HPC, and the parietal regions of the FPCN with the anterior regions of the HPC during delay. No regions showed a significant overall load effect in the probe period.

for (cond in seq.int(7,9)){
  print(names(suj_avg_list)[cond])
  for (roi in seq.int(2,34)){
    ttest_res <- (t.test(suj_avg_list[[cond]][,roi]))
    if (ttest_res$p.value < 0.05){
      print(colnames(suj_avg_list[[cond]])[roi])
    }
  }
}
## [1] "cue_load_effect"
## [1] "FPCN_Par_FFA"
## [1] "FPCN_Par_HPC_Med"
## [1] "delay_load_effect"
## [1] "FPCN_HPC_Ant"
## [1] "FPCN_PFC_HPC_Ant"
## [1] "FPCN_Par_HPC_Ant"
## [1] "FFA_HPC_Ant"
## [1] "probe_load_effect"
## [1] "HPC_HPC"

Directly compare across task period

As before, we can then directly compare across time periods. We’re not seeing anything too interesting here.

avg_data %>% 
  select(PTID, FPCN_FPCN, DMN_DMN, HPC_HPC, FFA_FFA) %>%
  melt(id.vars="PTID") %>% 
  filter(grepl("load_effect", PTID)) %>% 
  ggplot(aes(x=variable, y =value, fill = PTID))+
  geom_bar(stat="identity", position = "dodge")+
  ggtitle("Within Network Connectivity")+
  ylab("Connectivity")+
  xlab("Network")+
  theme_classic()

avg_data %>% 
  select(PTID, FPCN_DMN, FPCN_HPC, FPCN_FFA) %>%
  melt(id.vars="PTID") %>% 
  filter(grepl("load_effect", PTID)) %>% 
  ggplot(aes(x=variable, y =value, fill = PTID))+
  geom_bar(stat="identity", position = "dodge")+
  ggtitle("FPCN Connectivity")+
  ylab("Connectivity")+
  xlab("Network")+
  theme_classic()

avg_data %>% 
  select(PTID, FPCN_PFC_FPCN_Par, FPCN_PFC_DMN, FPCN_PFC_HPC, FPCN_PFC_FFA) %>%
  melt(id.vars="PTID") %>% 
  filter(grepl("load_effect", PTID)) %>% 
  ggplot(aes(x=variable, y =value, fill = PTID))+
  geom_bar(stat="identity", position = "dodge")+
  ggtitle("FPCN PFC region connectivity")+
  ylab("Connectivity")+
  xlab("Network")+
  theme_classic()

avg_data %>% 
  select(PTID, FPCN_PFC_FPCN_Par, FPCN_Par_DMN, FPCN_Par_HPC, FPCN_Par_FFA) %>%
  melt(id.vars="PTID") %>% 
  filter(grepl("load_effect", PTID)) %>% 
  ggplot(aes(x=variable, y =value, fill = PTID))+
  geom_bar(stat="identity", position = "dodge")+
  ggtitle("FPCN Parietal region connectivity")+
  ylab("Connectivity")+
  xlab("Network")+
  theme_classic()

avg_data %>% 
  select(PTID, FPCN_DMN, DMN_HPC, DMN_FFA) %>%
  melt(id.vars="PTID") %>% 
  filter(grepl("load_effect", PTID)) %>% 
  ggplot(aes(x=variable, y =value, fill = PTID))+
  geom_bar(stat="identity", position = "dodge")+
  ggtitle("DMN Connectivity")+
  ylab("Connectivity")+
  xlab("Network")+
  theme_classic()

avg_data %>% 
  select(PTID, FPCN_HPC, DMN_HPC, HPC_FFA) %>%
  melt(id.vars="PTID") %>% 
  filter(grepl("load_effect", PTID)) %>% 
  ggplot(aes(x=variable, y =value, fill = PTID))+
  geom_bar(stat="identity", position = "dodge")+
  ggtitle("HPC Connectivity")+
  ylab("Connectivity")+
  xlab("Network")+
  theme_classic()

avg_data %>% 
  select(PTID, FPCN_HPC_Ant, DMN_HPC_Ant, FFA_HPC_Ant) %>%
  melt(id.vars="PTID") %>% 
  filter(grepl("load_effect", PTID)) %>% 
  ggplot(aes(x=variable, y =value, fill = PTID))+
  geom_bar(stat="identity", position = "dodge")+
  ggtitle("Anterior HPC Connectivity")+
  ylab("Connectivity")+
  xlab("Network")+
  theme_classic()

avg_data %>% 
  select(PTID, FPCN_HPC_Med, DMN_HPC_Med, FFA_HPC_Med) %>%
  melt(id.vars="PTID") %>% 
  filter(grepl("load_effect", PTID)) %>% 
  ggplot(aes(x=variable, y =value, fill = PTID))+
  geom_bar(stat="identity", position = "dodge")+
  ggtitle("Medial HPC Connectivity")+
  ylab("Connectivity")+
  xlab("Network")+
  theme_classic()

avg_data %>% 
  select(PTID, FPCN_HPC_Post, DMN_HPC_Post, FFA_HPC_Post) %>%
  melt(id.vars="PTID") %>% 
  filter(grepl("load_effect", PTID)) %>% 
  ggplot(aes(x=variable, y =value, fill = PTID))+
  geom_bar(stat="identity", position = "dodge")+
  ggtitle("Posterior HPC Connectivity")+
  ylab("Connectivity")+
  xlab("Network")+
  theme_classic()

avg_data %>% 
  select(PTID, FPCN_FFA, DMN_FFA, HPC_FFA) %>%
  melt(id.vars="PTID") %>% 
  filter(grepl("load_effect", PTID)) %>% 
  ggplot(aes(x=variable, y =value, fill = PTID))+
  geom_bar(stat="identity", position = "dodge")+
  ggtitle("FFA Connectivity")+
  ylab("Connectivity")+
  xlab("Network")+
  theme_classic()

for (roi in seq.int(2,34)){
  
  temp_data <- data.frame(
    PTID = suj_avg_list[[1]]$PTID,
    cue = suj_avg_list[["cue_load_effect"]][,roi], 
    delay = suj_avg_list[["probe_load_effect"]][,roi], 
    probe = suj_avg_list[["probe_load_effect"]][,roi])
  
  temp_data <- melt(temp_data, id.vars="PTID")
  colnames(temp_data) <- c("PTID", "task_period", "connectivity")
  print(colnames(suj_avg_list[[1]][roi]))
  print(summary(aov(connectivity ~ task_period + Error(PTID), data = temp_data)))
  
}
## [1] "FPCN_FPCN"
## 
## Error: PTID
##           Df  Sum Sq Mean Sq F value Pr(>F)
## Residuals  1 0.01024 0.01024               
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2  0.043 0.02139   0.535  0.586
## Residuals   482 19.287 0.04002               
## [1] "DMN_DMN"
## 
## Error: PTID
##             Df Sum Sq Mean Sq
## task_period  1  0.278   0.278
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2   0.00 0.00000       0      1
## Residuals   488  21.73 0.04452               
## [1] "HPC_HPC"
## 
## Error: PTID
##             Df Sum Sq Mean Sq
## task_period  1  3.712   3.712
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2    1.2  0.5918   0.847  0.429
## Residuals   490  342.5  0.6990               
## [1] "FFA_FFA"
## 
## Error: PTID
##           Df Sum Sq Mean Sq F value Pr(>F)
## Residuals  1  7.188   7.188               
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2      1   0.356   0.019  0.981
## Residuals   494   9067  18.354               
## [1] "FPCN_DMN"
## 
## Error: PTID
##             Df  Sum Sq Mean Sq
## task_period  1 0.09637 0.09637
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2  0.003 0.00137   0.032  0.968
## Residuals   483 20.373 0.04218               
## [1] "FPCN_HPC"
## 
## Error: PTID
##             Df Sum Sq Mean Sq
## task_period  1 0.1285  0.1285
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2  0.021 0.01039   0.175  0.839
## Residuals   484 28.725 0.05935               
## [1] "FPCN_FFA"
## 
## Error: PTID
##             Df Sum Sq Mean Sq
## task_period  1 0.1091  0.1091
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2  0.008 0.00399   0.062   0.94
## Residuals   483 30.956 0.06409               
## [1] "DMN_HPC"
## 
## Error: PTID
##             Df  Sum Sq Mean Sq
## task_period  1 0.01914 0.01914
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2  0.002 0.00119   0.024  0.976
## Residuals   481 23.687 0.04925               
## [1] "DMN_FFA"
## 
## Error: PTID
##             Df Sum Sq Mean Sq
## task_period  1 0.3901  0.3901
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2   0.03 0.01727   0.241  0.786
## Residuals   485  34.69 0.07152               
## [1] "HPC_FFA"
## 
## Error: PTID
##             Df Sum Sq Mean Sq
## task_period  1 0.3782  0.3782
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2   0.03 0.01349   0.138  0.871
## Residuals   484  47.44 0.09803               
## [1] "FPCN_PFC_FPCN_PFC"
## 
## Error: PTID
##             Df   Sum Sq  Mean Sq
## task_period  1 0.003382 0.003382
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2   0.06 0.03135    0.47  0.626
## Residuals   487  32.51 0.06676               
## [1] "FPCN_PFC_FPCN_Par"
## 
## Error: PTID
##           Df Sum Sq Mean Sq F value Pr(>F)
## Residuals  1 0.0127  0.0127               
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2  0.029 0.01442   0.297  0.744
## Residuals   482 23.437 0.04863               
## [1] "FPCN_PFC_DMN"
## 
## Error: PTID
##             Df  Sum Sq Mean Sq
## task_period  1 0.09221 0.09221
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2  0.002 0.00081   0.017  0.983
## Residuals   486 23.774 0.04892               
## [1] "FPCN_PFC_HPC"
## 
## Error: PTID
##           Df  Sum Sq Mean Sq F value Pr(>F)
## Residuals  1 0.05142 0.05142               
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2   0.01 0.00642   0.093  0.911
## Residuals   488  33.82 0.06930               
## [1] "FPCN_PFC_FFA"
## 
## Error: PTID
##             Df Sum Sq Mean Sq
## task_period  1  0.308   0.308
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2   0.00 0.00038   0.004  0.996
## Residuals   485  41.66 0.08590               
## [1] "FPCN_Par_DMN"
## 
## Error: PTID
##             Df  Sum Sq Mean Sq
## task_period  1 0.06493 0.06493
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2  0.006 0.00303   0.058  0.943
## Residuals   485 25.100 0.05175               
## [1] "FPCN_Par_HPC"
## 
## Error: PTID
##             Df Sum Sq Mean Sq
## task_period  1 0.2941  0.2941
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2   0.05 0.02410   0.318  0.728
## Residuals   483  36.64 0.07587               
## [1] "FPCN_Par_FFA"
## 
## Error: PTID
##             Df  Sum Sq Mean Sq
## task_period  1 0.07465 0.07465
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2   0.04 0.02243   0.326  0.722
## Residuals   481  33.04 0.06869               
## [1] "FPCN_HPC_Ant"
## 
## Error: PTID
##             Df Sum Sq Mean Sq
## task_period  1 0.3798  0.3798
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2   0.01 0.00417   0.048  0.953
## Residuals   481  41.42 0.08611               
## [1] "FPCN_PFC_HPC_Ant"
## 
## Error: PTID
##             Df Sum Sq Mean Sq
## task_period  1 0.4467  0.4467
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2   0.03  0.0162   0.156  0.855
## Residuals   486  50.40  0.1037               
## [1] "FPCN_Par_HPC_Ant"
## 
## Error: PTID
##             Df Sum Sq Mean Sq
## task_period  1 0.3831  0.3831
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2   0.01 0.00703   0.061  0.941
## Residuals   483  55.88 0.11569               
## [1] "DMN_HPC_Ant"
## 
## Error: PTID
##             Df Sum Sq Mean Sq
## task_period  1 0.3049  0.3049
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2   0.00 0.00003       0      1
## Residuals   483  44.43 0.09199               
## [1] "FFA_HPC_Ant"
## 
## Error: PTID
##             Df Sum Sq Mean Sq
## task_period  1 0.8736  0.8736
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2   0.06 0.03224   0.211   0.81
## Residuals   483  73.71 0.15261               
## [1] "FPCN_HPC_Med"
## 
## Error: PTID
##             Df Sum Sq Mean Sq
## task_period  1 0.4108  0.4108
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2   0.09 0.04562   0.649  0.523
## Residuals   486  34.18 0.07032               
## [1] "FPCN_PFC_HPC_Med"
## 
## Error: PTID
##             Df Sum Sq Mean Sq
## task_period  1 0.4141  0.4141
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2   0.00 0.00102   0.012  0.988
## Residuals   489  40.56 0.08295               
## [1] "FPCN_Par_HPC_Med"
## 
## Error: PTID
##             Df Sum Sq Mean Sq
## task_period  1 0.2592  0.2592
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2   0.06 0.02933   0.341  0.712
## Residuals   484  41.67 0.08610               
## [1] "DMN_HPC_Med"
## 
## Error: PTID
##             Df Sum Sq Mean Sq
## task_period  1 0.1176  0.1176
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2   0.00 0.00000       0      1
## Residuals   486  31.22 0.06423               
## [1] "FFA_HPC_Med"
## 
## Error: PTID
##             Df Sum Sq Mean Sq
## task_period  1 0.5854  0.5854
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2   0.00 0.00073   0.006  0.994
## Residuals   483  55.36 0.11461               
## [1] "FPCN_HPC_Post"
## 
## Error: PTID
##             Df Sum Sq Mean Sq
## task_period  1 0.0207  0.0207
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2   0.08 0.03865   0.455  0.635
## Residuals   484  41.14 0.08500               
## [1] "FPCN_PFC_HPC_Post"
## 
## Error: PTID
##             Df  Sum Sq Mean Sq
## task_period  1 0.00448 0.00448
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2   0.16 0.08039   0.746  0.475
## Residuals   486  52.38 0.10778               
## [1] "FPCN_Par_HPC_Post"
## 
## Error: PTID
##             Df  Sum Sq Mean Sq
## task_period  1 0.02131 0.02131
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2   0.04 0.02203   0.218  0.804
## Residuals   482  48.74 0.10112               
## [1] "DMN_HPC_Post"
## 
## Error: PTID
##             Df  Sum Sq Mean Sq
## task_period  1 0.02108 0.02108
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2   0.02 0.00968   0.143  0.867
## Residuals   481  32.61 0.06779               
## [1] "FFA_HPC_Post"
## 
## Error: PTID
##             Df Sum Sq Mean Sq
## task_period  1 0.2434  0.2434
## 
## Error: Within
##              Df Sum Sq Mean Sq F value Pr(>F)
## task_period   2   0.05 0.02358   0.156  0.856
## Residuals   484  73.29 0.15142

By WM group

Now, let’s look across WM groups (which we care more about anyways). Here, we see differences within HPC in the cue, for the DMN/FFA (low > medium), HPC/FFA (low > medium), parietal regions of the FPCN/DMN (low > medium, with high > medium trending), FFA/anterior HPC regions (low > medium and high) during delay, and parietal regions of the FPCN/FFA (high > low), FFA/posterior HPC (high > low) in probe.

plot_list_load_effect <- list() 

for (cond in seq.int(7,9)){
  
  cond_list <- list()
  
  suj_avg_list[[cond]] %>% 
    melt() %>%
    filter(variable %in% c("FPCN_FPCN", "DMN_DMN", "HPC_HPC", "FFA_FFA")) %>%
    group_by(level, variable) %>% 
    summarise(average = mean(value, na.rm=TRUE), se_val = se(value), se_min = average-se_val, se_max = average+se_val) %>% 
    mutate(level = factor(level, levels = c("low", "med", "high"))) %>%
    ggplot(aes(x=variable, y = average, fill=level)) + 
    geom_bar(stat="identity", position = "dodge")+
    geom_errorbar(aes(ymin = se_min, ymax = se_max), width=0.1, position = position_dodge(0.9))+
    xlab("Regions")+
    ylab("Average Connectivity")+
    ggtitle(paste(names(suj_avg_list)[cond]))+
    theme_classic()+
    theme(aspect.ratio=1, axis.text.x = element_text(angle = 45, vjust = 0.5)) -> cond_list[["within"]]
  
  suj_avg_list[[cond]] %>% 
    melt() %>%
    filter(variable %in% c("FPCN_DMN", "FPCN_HPC", "FPCN_FFA")) %>%
    group_by(level, variable) %>% 
    summarise(average = mean(value, na.rm=TRUE), se_val = se(value), se_min = average-se_val, se_max = average+se_val) %>% 
    mutate(level = factor(level, levels = c("low", "med", "high"))) %>%
    ggplot(aes(x=variable, y = average, fill=level)) + 
    geom_bar(stat="identity", position = "dodge")+
    geom_errorbar(aes(ymin = se_min, ymax = se_max), width=0.1, position = position_dodge(0.9))+
    xlab("Regions")+
    ylab("Average Connectivity")+
    ggtitle(paste(names(suj_avg_list)[cond]))+
    theme_classic()+
    theme(aspect.ratio=1, axis.text.x = element_text(angle = 45, vjust = 0.5)) -> cond_list[["FPCN"]]
  
  suj_avg_list[[cond]] %>% 
    melt() %>%
    filter(variable %in% c("FPCN_DMN", "DMN_HPC","DMN_FFA")) %>%
    group_by(level, variable) %>% 
    summarise(average = mean(value, na.rm=TRUE), se_val = se(value), se_min = average-se_val, se_max = average+se_val) %>% 
    mutate(level = factor(level, levels = c("low", "med", "high"))) %>%
    ggplot(aes(x=variable, y = average, fill=level)) + 
    geom_bar(stat="identity", position = "dodge")+
    geom_errorbar(aes(ymin = se_min, ymax = se_max), width=0.1, position = position_dodge(0.9))+
    xlab("Regions")+
    ylab("Average Connectivity")+
    ggtitle(paste(names(suj_avg_list)[cond]))+
    theme_classic()+
    theme(aspect.ratio=1, axis.text.x = element_text(angle = 45, vjust = 0.5)) -> cond_list[["DMN"]]
  
  suj_avg_list[[cond]] %>% 
    melt() %>%
    filter(variable %in% c("FPCN_HPC", "DMN_HPC","HPC_FFA")) %>%
    group_by(level, variable) %>% 
    summarise(average = mean(value, na.rm=TRUE), se_val = se(value), se_min = average-se_val, se_max = average+se_val) %>% 
    mutate(level = factor(level, levels = c("low", "med", "high"))) %>%
    ggplot(aes(x=variable, y = average, fill=level)) + 
    geom_bar(stat="identity", position = "dodge")+
    geom_errorbar(aes(ymin = se_min, ymax = se_max), width=0.1, position = position_dodge(0.9))+
    xlab("Regions")+
    ylab("Average Connectivity")+
    ggtitle(paste(names(suj_avg_list)[cond]))+
    theme_classic()+
    theme(aspect.ratio=1, axis.text.x = element_text(angle = 45, vjust = 0.5)) -> cond_list[["HPC"]]
  
  suj_avg_list[[cond]] %>% 
    melt() %>%
    filter(variable %in% c("FPCN_HPC_Ant", "DMN_HPC_Ant","FFA_HPC_Ant")) %>%
    group_by(level, variable) %>% 
    summarise(average = mean(value, na.rm=TRUE), se_val = se(value), se_min = average-se_val, se_max = average+se_val) %>% 
    mutate(level = factor(level, levels = c("low", "med", "high"))) %>%
    ggplot(aes(x=variable, y = average, fill=level)) + 
    geom_bar(stat="identity", position = "dodge")+
    geom_errorbar(aes(ymin = se_min, ymax = se_max), width=0.1, position = position_dodge(0.9))+
    xlab("Regions")+
    ylab("Average Connectivity")+
    ggtitle(paste(names(suj_avg_list)[cond]))+
    theme_classic()+
    theme(aspect.ratio=1, axis.text.x = element_text(angle = 45, vjust = 0.5)) -> cond_list[["HPC_Ant"]]
  
  suj_avg_list[[cond]] %>% 
    melt() %>%
    filter(variable %in% c("FPCN_HPC_Med", "DMN_HPC_Med","FFA_HPC_Med")) %>%
    group_by(level, variable) %>% 
    summarise(average = mean(value, na.rm=TRUE), se_val = se(value), se_min = average-se_val, se_max = average+se_val) %>% 
    mutate(level = factor(level, levels = c("low", "med", "high"))) %>%
    ggplot(aes(x=variable, y = average, fill=level)) + 
    geom_bar(stat="identity", position = "dodge")+
    geom_errorbar(aes(ymin = se_min, ymax = se_max), width=0.1, position = position_dodge(0.9))+
    xlab("Regions")+
    ylab("Average Connectivity")+
    ggtitle(paste(names(suj_avg_list)[cond]))+
    theme_classic()+
    theme(aspect.ratio=1, axis.text.x = element_text(angle = 45, vjust = 0.5)) -> cond_list[["HPC_Med"]]
  
  suj_avg_list[[cond]] %>% 
    melt() %>%
    filter(variable %in% c("FPCN_HPC_Post", "DMN_HPC_Post","FFA_HPC_Post")) %>%
    group_by(level, variable) %>% 
    summarise(average = mean(value, na.rm=TRUE), se_val = se(value), se_min = average-se_val, se_max = average+se_val) %>% 
    mutate(level = factor(level, levels = c("low", "med", "high"))) %>%
    ggplot(aes(x=variable, y = average, fill=level)) + 
    geom_bar(stat="identity", position = "dodge")+
    geom_errorbar(aes(ymin = se_min, ymax = se_max), width=0.1, position = position_dodge(0.9))+
    xlab("Regions")+
    ylab("Average Connectivity")+
    ggtitle(paste(names(suj_avg_list)[cond]))+
    theme_classic()+
    theme(aspect.ratio=1, axis.text.x = element_text(angle = 45, vjust = 0.5)) -> cond_list[["HPC_Post"]]
  
  
  suj_avg_list[[cond]] %>% 
    melt() %>%
    filter(variable %in% c("FPCN_FFA", "DMN_FFA","HPC_FFA")) %>%
    group_by(level, variable) %>% 
    summarise(average = mean(value, na.rm=TRUE), se_val = se(value), se_min = average-se_val, se_max = average+se_val) %>% 
    mutate(level = factor(level, levels = c("low", "med", "high"))) %>%
    ggplot(aes(x=variable, y = average, fill=level)) + 
    geom_bar(stat="identity", position = "dodge")+
    geom_errorbar(aes(ymin = se_min, ymax = se_max), width=0.1, position = position_dodge(0.9))+
    xlab("Regions")+
    ylab("Average Connectivity")+
    ggtitle(paste(names(suj_avg_list)[cond]))+
    theme_classic()+
    theme(aspect.ratio=1, axis.text.x = element_text(angle = 45, vjust = 0.5)) -> cond_list[["FFA"]]
  
  suj_avg_list[[cond]] %>% 
    melt() %>%
    filter(variable %in% c("FPCN_PFC_FPCN_Par", "FPCN_PFC_DMN", "FPCN_PFC_HPC", "FPCN_PFC_FFA")) %>%
    group_by(level, variable) %>% 
    summarise(average = mean(value, na.rm=TRUE), se_val = se(value), se_min = average-se_val, se_max = average+se_val) %>% 
    mutate(level = factor(level, levels = c("low", "med", "high"))) %>%
    ggplot(aes(x=variable, y = average, fill=level)) + 
    geom_bar(stat="identity", position = "dodge")+
    geom_errorbar(aes(ymin = se_min, ymax = se_max), width=0.1, position = position_dodge(0.9))+
    xlab("Regions")+
    ylab("Average Connectivity")+
    ggtitle(paste(names(suj_avg_list)[cond]))+
    theme_classic()+
    theme(aspect.ratio=1, axis.text.x = element_text(angle = 45, vjust = 0.5)) -> cond_list[["FPCN_PFC"]]
  
  
  suj_avg_list[[cond]] %>% 
    melt() %>%
    filter(variable %in% c("FPCN_PFC_FPCN_Par", "FPCN_Par_DMN", "FPCN_Par_HPC", "FPCN_Par_FFA")) %>%
    group_by(level, variable) %>% 
    summarise(average = mean(value, na.rm=TRUE), se_val = se(value), se_min = average-se_val, se_max = average+se_val) %>% 
    mutate(level = factor(level, levels = c("low", "med", "high"))) %>%
    ggplot(aes(x=variable, y = average, fill=level)) + 
    geom_bar(stat="identity", position = "dodge")+
    geom_errorbar(aes(ymin = se_min, ymax = se_max), width=0.1, position = position_dodge(0.9))+
    xlab("Regions")+
    ylab("Average Connectivity")+
    ggtitle(paste(names(suj_avg_list)[cond]))+
    theme_classic()+
    theme(aspect.ratio=1, axis.text.x = element_text(angle = 45, vjust = 0.5)) -> cond_list[["FPCN_Par"]]
  
  plot_list_load_effect[[names(suj_avg_list)[cond]]] <- cond_list
}

plot_list_load_effect[["cue_load_effect"]][["within"]] + plot_list_load_effect[["delay_load_effect"]][["within"]] + plot_list_load_effect[["probe_load_effect"]][["within"]] +
  plot_layout(guides="collect")+
  plot_annotation(title = "Within Network Connectivity")

plot_list_load_effect[["cue_load_effect"]][["FPCN"]] + plot_list_load_effect[["delay_load_effect"]][["FPCN"]] + plot_list_load_effect[["probe_load_effect"]][["FPCN"]] +
  plot_layout(guides="collect")+
  plot_annotation(title = "FPCN Connectivity")

plot_list_load_effect[["cue_load_effect"]][["FPCN_PFC"]] + plot_list_load_effect[["delay_load_effect"]][["FPCN_PFC"]] + plot_list_load_effect[["probe_load_effect"]][["FPCN_PFC"]] +
  plot_layout(guides="collect")+
  plot_annotation(title = "FPCN PFC regions Connectivity")

plot_list_load_effect[["cue_load_effect"]][["FPCN_Par"]] + plot_list_load_effect[["delay_load_effect"]][["FPCN_Par"]]+ plot_list_load_effect[["probe_load_effect"]][["FPCN_Par"]] +
  plot_layout(guides="collect")+
  plot_annotation(title = "FPCN parietal regions Connectivity")

plot_list_load_effect[["cue_load_effect"]][["DMN"]] + plot_list_load_effect[["delay_load_effect"]][["DMN"]] + 
  plot_list_load_effect[["probe_load_effect"]][["DMN"]] +
  plot_layout(guides="collect")+
  plot_annotation(title = "DMN Connectivity")

plot_list_load_effect[["cue_load_effect"]][["HPC"]] + plot_list_load_effect[["delay_load_effect"]][["HPC"]] + 
  plot_list_load_effect[["probe_load_effect"]][["HPC"]] +
  plot_layout(guides="collect")+
  plot_annotation(title = "HPC Connectivity")

plot_list_load_effect[["cue_load_effect"]][["HPC_Ant"]] + plot_list_load_effect[["delay_load_effect"]][["HPC_Ant"]] + 
  plot_list_load_effect[["probe_load_effect"]][["HPC_Ant"]] +
  plot_layout(guides="collect")+
  plot_annotation(title = "Anterior HPC Connectivity")

plot_list_load_effect[["cue_load_effect"]][["HPC_Med"]] + plot_list_load_effect[["delay_load_effect"]][["HPC_Med"]] + 
  plot_list_load_effect[["probe_load_effect"]][["HPC_Med"]] +
  plot_layout(guides="collect")+
  plot_annotation(title = "Medial HPC Connectivity")

plot_list_load_effect[["cue_load_effect"]][["HPC_Post"]] + plot_list_load_effect[["delay_load_effect"]][["HPC_Post"]] + 
  plot_list_load_effect[["probe_load_effect"]][["HPC_Post"]] +
  plot_layout(guides="collect")+
  plot_annotation(title = "Posterior HPC Connectivity")

plot_list_load_effect[["cue_load_effect"]][["FFA"]] + plot_list_load_effect[["delay_load_effect"]][["FFA"]] + 
  plot_list_load_effect[["probe_load_effect"]][["FFA"]] +
  plot_layout(guides="collect")+
  plot_annotation(title = "FFA Connectivity")

# for (cond in seq.int(7,9)){
#   print(names(suj_avg_list)[cond])
#   anova_results <- purrr::map(suj_avg_list[[cond]][,2:34], ~aov(.x ~ suj_avg_list[[cond]]$level ))
#   for (measure in seq.int(1,33)){
#     print(colnames(suj_avg_list[[cond]])[measure+1])
#     print(summary(anova_results[[measure]]))
#   }
# }

print(TukeyHSD(aov(HPC_HPC ~ level, data = suj_avg_list[["cue_load_effect"]])))
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = HPC_HPC ~ level, data = suj_avg_list[["cue_load_effect"]])
## 
## $level
##                diff        lwr         upr     p adj
## low-high -0.2688836 -0.6587372  0.12097007 0.2353652
## med-high -0.4401530 -0.8300067 -0.05029939 0.0225964
## med-low  -0.1712695 -0.5593307  0.21679175 0.5502562
print(TukeyHSD(aov(DMN_FFA ~ level, data = suj_avg_list[["delay_load_effect"]])))
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = DMN_FFA ~ level, data = suj_avg_list[["delay_load_effect"]])
## 
## $level
##                 diff         lwr         upr     p adj
## low-high  0.05706789 -0.06134706  0.17548284 0.4909489
## med-high -0.10424375 -0.22321057  0.01472308 0.0987491
## med-low  -0.16131164 -0.28080821 -0.04181507 0.0047901
print(TukeyHSD(aov(HPC_FFA ~ level, data = suj_avg_list[["delay_load_effect"]])))
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = HPC_FFA ~ level, data = suj_avg_list[["delay_load_effect"]])
## 
## $level
##                 diff         lwr         upr     p adj
## low-high  0.07625153 -0.04540013  0.19790320 0.3019064
## med-high -0.07714449 -0.19879615  0.04450718 0.2936061
## med-low  -0.15339602 -0.27504769 -0.03174435 0.0092029
print(TukeyHSD(aov(FPCN_Par_DMN ~ level, data = suj_avg_list[["delay_load_effect"]])))
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = FPCN_Par_DMN ~ level, data = suj_avg_list[["delay_load_effect"]])
## 
## $level
##                 diff        lwr          upr     p adj
## low-high  0.01280086 -0.0728181  0.098419821 0.9333968
## med-high -0.07860473 -0.1642237  0.007014234 0.0791664
## med-low  -0.09140559 -0.1774164 -0.005394774 0.0343488
print(TukeyHSD(aov(FFA_HPC_Ant ~ level, data = suj_avg_list[["delay_load_effect"]])))
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = FFA_HPC_Ant ~ level, data = suj_avg_list[["delay_load_effect"]])
## 
## $level
##                 diff           lwr         upr     p adj
## low-high  0.14176626 -0.0002304109  0.28376293 0.0504746
## med-high -0.04855659 -0.1905532566  0.09344008 0.6980985
## med-low  -0.19032285 -0.3329577051 -0.04768799 0.0053828
print(TukeyHSD(aov(FPCN_Par_FFA ~ level, data = suj_avg_list[["probe_load_effect"]])))
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = FPCN_Par_FFA ~ level, data = suj_avg_list[["probe_load_effect"]])
## 
## $level
##                 diff         lwr          upr     p adj
## low-high -0.11871513 -0.23785569 0.0004254353 0.0510489
## med-high -0.01755533 -0.13785665 0.1027459884 0.9364381
## med-low   0.10115980 -0.02020943 0.2225290201 0.1225360
print(TukeyHSD(aov(FFA_HPC_Post ~ level, data = suj_avg_list[["probe_load_effect"]])))
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = FFA_HPC_Post ~ level, data = suj_avg_list[["probe_load_effect"]])
## 
## $level
##                 diff        lwr         upr     p adj
## low-high -0.19027688 -0.3602932 -0.02026053 0.0240834
## med-high -0.14189745 -0.3143703  0.03057540 0.1291917
## med-low   0.04837943 -0.1248467  0.22160557 0.7865541

Correlation of load effect with omnibus span

Another way of looking at linear relationships is to look for correlations between connectivity and span. We see significant correlations between span and within FPCN PFC regions and FPCN parietal regions/DMN connectivity at cue, FFA/anterior HPC in delay (which is a negative correlation) and FPCN/FFA (specifically PFC, though trending towards Par), FPCN/Medial HPC, FFA/posterior HPC in probe.

# for (cond in seq.int(7,9)){
#   print(names(suj_avg_list)[cond])
#   
#   for (measure in seq.int(2, 34)){
#     print(colnames(suj_avg_list[[cond]])[measure])
#     print(cor.test(suj_avg_list[[cond]][,measure], suj_avg_list[[cond]]$omnibus_span_no_DFR))
#     
#   }
# }

cor.test(suj_avg_list[[7]]$FPCN_PFC_FPCN_PFC, suj_avg_list[[cond]]$omnibus_span_no_DFR)
## 
##  Pearson's product-moment correlation
## 
## data:  suj_avg_list[[7]]$FPCN_PFC_FPCN_PFC and suj_avg_list[[cond]]$omnibus_span_no_DFR
## t = 2.3792, df = 161, p-value = 0.01852
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.03146259 0.32870037
## sample estimates:
##       cor 
## 0.1842918
ggplot(data = suj_avg_list[[7]], aes(x=omnibus_span_no_DFR, y = FPCN_PFC_FPCN_PFC))+
  geom_point()+
  stat_smooth(method="lm")+
  theme_classic()+
  theme(aspect.ratio=1)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 4 rows containing non-finite values (stat_smooth).
## Warning: Removed 4 rows containing missing values (geom_point).

cor.test(suj_avg_list[[7]]$FPCN_Par_DMN, suj_avg_list[[cond]]$omnibus_span_no_DFR)
## 
##  Pearson's product-moment correlation
## 
## data:  suj_avg_list[[7]]$FPCN_Par_DMN and suj_avg_list[[cond]]$omnibus_span_no_DFR
## t = 1.7872, df = 161, p-value = 0.07578
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.01455707  0.28704177
## sample estimates:
##       cor 
## 0.1394755
ggplot(data = suj_avg_list[[7]], aes(x=omnibus_span_no_DFR, y = FPCN_Par_DMN))+
  geom_point()+
  stat_smooth(method="lm")+
  theme_classic()+
  theme(aspect.ratio=1)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 4 rows containing non-finite values (stat_smooth).

## Warning: Removed 4 rows containing missing values (geom_point).

cor.test(suj_avg_list[[8]]$FFA_HPC_Ant, suj_avg_list[[cond]]$omnibus_span_no_DFR)
## 
##  Pearson's product-moment correlation
## 
## data:  suj_avg_list[[8]]$FFA_HPC_Ant and suj_avg_list[[cond]]$omnibus_span_no_DFR
## t = -2.1602, df = 164, p-value = 0.03221
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.3107841 -0.0143797
## sample estimates:
##        cor 
## -0.1663369
ggplot(data = suj_avg_list[[8]], aes(x=omnibus_span_no_DFR, y = FFA_HPC_Ant))+
  geom_point()+
  stat_smooth(method="lm")+
  theme_classic()+
  theme(aspect.ratio=1)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 rows containing missing values (geom_point).

cor.test(suj_avg_list[[9]]$FPCN_FFA, suj_avg_list[[cond]]$omnibus_span_no_DFR)
## 
##  Pearson's product-moment correlation
## 
## data:  suj_avg_list[[9]]$FPCN_FFA and suj_avg_list[[cond]]$omnibus_span_no_DFR
## t = 2.1452, df = 161, p-value = 0.03344
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.01332075 0.31241470
## sample estimates:
##       cor 
## 0.1666999
ggplot(data = suj_avg_list[[9]], aes(x=omnibus_span_no_DFR, y = FPCN_FFA))+
  geom_point()+
  stat_smooth(method="lm")+
  theme_classic()+
  theme(aspect.ratio=1)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 4 rows containing non-finite values (stat_smooth).
## Warning: Removed 4 rows containing missing values (geom_point).

cor.test(suj_avg_list[[9]]$FPCN_PFC_FFA, suj_avg_list[[cond]]$omnibus_span_no_DFR)
## 
##  Pearson's product-moment correlation
## 
## data:  suj_avg_list[[9]]$FPCN_PFC_FFA and suj_avg_list[[cond]]$omnibus_span_no_DFR
## t = 2.0223, df = 161, p-value = 0.0448
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.003761035 0.303761765
## sample estimates:
##       cor 
## 0.1573905
ggplot(data = suj_avg_list[[9]], aes(x=omnibus_span_no_DFR, y = FPCN_PFC_FFA))+
  geom_point()+
  stat_smooth(method="lm")+
  theme_classic()+
  theme(aspect.ratio=1)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 4 rows containing non-finite values (stat_smooth).

## Warning: Removed 4 rows containing missing values (geom_point).

cor.test(suj_avg_list[[9]]$FPCN_Par_FFA, suj_avg_list[[cond]]$omnibus_span_no_DFR)
## 
##  Pearson's product-moment correlation
## 
## data:  suj_avg_list[[9]]$FPCN_Par_FFA and suj_avg_list[[cond]]$omnibus_span_no_DFR
## t = 1.9647, df = 160, p-value = 0.05119
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.0007331023  0.3005620960
## sample estimates:
##       cor 
## 0.1534797
ggplot(data = suj_avg_list[[9]], aes(x=omnibus_span_no_DFR, y = FPCN_Par_FFA))+
  geom_point()+
  stat_smooth(method="lm")+
  theme_classic()+
  theme(aspect.ratio=1)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 5 rows containing non-finite values (stat_smooth).
## Warning: Removed 5 rows containing missing values (geom_point).

cor.test(suj_avg_list[[9]]$FPCN_HPC_Med, suj_avg_list[[cond]]$omnibus_span_no_DFR)
## 
##  Pearson's product-moment correlation
## 
## data:  suj_avg_list[[9]]$FPCN_HPC_Med and suj_avg_list[[cond]]$omnibus_span_no_DFR
## t = 1.9462, df = 162, p-value = 0.05336
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.002147489  0.297510485
## sample estimates:
##       cor 
## 0.1511521
ggplot(data = suj_avg_list[[9]], aes(x=omnibus_span_no_DFR, y = FPCN_HPC_Med))+
  geom_point()+
  stat_smooth(method="lm")+
  theme_classic()+
  theme(aspect.ratio=1)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (stat_smooth).
## Warning: Removed 3 rows containing missing values (geom_point).

cor.test(suj_avg_list[[9]]$FFA_HPC_Post, suj_avg_list[[cond]]$omnibus_span_no_DFR)
## 
##  Pearson's product-moment correlation
## 
## data:  suj_avg_list[[9]]$FFA_HPC_Post and suj_avg_list[[cond]]$omnibus_span_no_DFR
## t = 3.0779, df = 161, p-value = 0.002451
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.0850984 0.3758363
## sample estimates:
##       cor 
## 0.2357351
ggplot(data = suj_avg_list[[9]], aes(x=omnibus_span_no_DFR, y = FFA_HPC_Post))+
  geom_point()+
  stat_smooth(method="lm")+
  theme_classic()+
  theme(aspect.ratio=1)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 4 rows containing non-finite values (stat_smooth).
## Warning: Removed 4 rows containing missing values (geom_point).